package day20180405;

import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class TestWritePOI07 {

    public void writeExcel07() throws IOException {

        //创建工作簿
        XSSFWorkbook workbook = new XSSFWorkbook();

        //创建工作表
        XSSFSheet sheet = workbook.createSheet("helloworld");

        //创建行
        XSSFRow row = sheet.createRow(2);

        //创建单元格，操作第三行第三列
        XSSFCell cell = row.createCell(2, CellType.STRING);
        cell.setCellValue("helloworld");

        FileOutputStream outputStream = new FileOutputStream(new File("F:\\poi.xlsx"));
        workbook.write(outputStream);

        workbook.close();

    }

}
